package cloudspace.vm.javassist.tests;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;
import cloudspace.vm.javassist.AbstractCommand;
import cloudspace.vm.javassist.MalformedCommandException;
import cloudspace.vm.javassist.Replace;

public class CommandTest extends TestCase
{
	public void testReplaceConstCall()
	{
		List<String> arguments = new ArrayList<String>();
		arguments.add("replace");
		arguments.add("ConstructorCall");
		arguments.add("toReplace");
		arguments.add("with");
		arguments.add("ReplaceWith");
		
		
		try
		{
			Replace curCommand = new Replace(arguments);
			assertEquals(AbstractCommand.SignatureType.CONSTRUCTORCALL,curCommand.getSignatureType());
			//assertEquals(AbstractCommand.TranslationType.REPLACE,curCommand.getTranslationType());
			assertEquals("ReplaceWith",curCommand.getReplacement());
			assertEquals("toReplace",curCommand.getSignature());
			
		}
		catch (MalformedCommandException e)
		{
			e.printStackTrace();
			fail("Did not read Command list properly");
			
		}
	}
}
